package com.qiche.service2.impl;

import com.qiche.mapper2.Member2Mapper;
import com.qiche.model.Member2;
import com.qiche.service.impl.BaseService;
import com.qiche.service2.Member2Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author chendezhi
 * @date 2018/3/29 16:21
 */
@Service
public class Member2ServiceImpl extends BaseService<Member2> implements Member2Service {
    @Autowired
    private Member2Mapper member2Mapper;
    @Override
    public Member2 selectByMemberPhone(String memberPhone) {
        Example example = new Example(Member2.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("phone",memberPhone);
        List<Member2> member2s = selectByExample(example);
        if (member2s==null||member2s.size()==0){
            return null;
        }
        return member2s.get(0);
    }
}
